<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>员工信息表</title>
<style>
*{ margin:0; padding:0;}
body{ font-size:14px; text-align:left;}
h3{ width:670px; height:30px; line-height:30px; text-align:center; margin:0 auto;}
td{ text-align:center; border:1px solid #799fc2;}
.bt{ background:#99cdff;}
</style>

<?php
include 'connect.php';

if ($_GET['action']=="del1"){
	$query = mysql_query("delete from tb_emp where e_id= ".$_GET['id']);
	echo "<script type='text/javascript'>alert('删除成功');window.location.href='index.php';</script>";
}

?>
</head>
<body>
   <h3>员工信息表</h3>

   <table border=1px cellpadding="0" cellspacing="0" width="670" style="margin:0 auto;">
<?php
$query = mysql_query("select * from tb_emp");
				
						 echo '<tr class=bt>  <td>ID</td><td>姓名</td><td>所属部门</td><td>头像</td><td>出生日期</td> <td>入职日期</td> <td>相关操作</td></tr>';
					 while($row = mysql_fetch_array($query,MYSQL_ASSOC)){
			
						echo '<tr>
						    <td>'.$row['e_id'].'</td> <td>'.$row['e_name'].'</td> <td>'.$row['e_dept'].'</td> <td><img src=images/'.$row['e_img'].' width=50px;height=30px;></td> <td>'.$row['date_of_birth'].'</td><td>'.$row['date_of_entry'].'</td>   <td><a href="xiugai.php?id='.$row['e_id'].'">修改</a> <a href="?action=del1&id='.$row['e_id'].'">删除</a></td></tr>';
				}
				
			?>

</table>

</body>
</html>
